//
//  SceneSetCell.m
//  GKBHouse
//
//  Created by  on 12-7-24.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "SceneSetCell.h"

@implementation SceneSetCell
@synthesize name, check;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self initCell];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)initCell
{
    //[self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"sceneCell.png"]]];
    //[self setBackgroundColor:[UIColor redColor]];
    UIImageView *back = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sceneCell.png"]];
    [back setFrame:CGRectMake(10, 2, 300, 46)];
    [self addSubview:back];
    [back release];
    
    UILabel *nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 2, 180, 46)];
    [nameLabel setBackgroundColor:[UIColor clearColor]];
    [nameLabel setTextColor:[UIColor whiteColor]];
    [nameLabel setFont:[UIFont boldSystemFontOfSize:19]];
    [self addSubview:nameLabel];
    self.name = nameLabel;
    [nameLabel release];
    
    UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
    [but setImage:[UIImage imageNamed:@"uncheck.png"] forState:UIControlStateNormal];
    [but setImage:[UIImage imageNamed:@"check.png"] forState:UIControlStateSelected];
    [but setFrame:CGRectMake(266, 2, 46, 46)];
//    [but addTarget:self action:@selector(checkAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:but];
    self.check = but;
}
- (void)checkAction:(UIButton *)but
{
    but.selected = !but.selected;
}
@end
